//
//  DptDAO.m
//  CoreDataDemo
//
//  Created by chenguibang on 16/2/29.
//  Copyright © 2016年 chenguibang. All rights reserved.
//

#import "DptDAO.h"
#import "Department+CoreDataProperties.h"
@implementation DptDAO
-(BOOL)insert:(DptModel *)model{
    
    NSManagedObjectContext *cxt = [self managedObjectContext];
    Department *insertmodel =(Department*)[NSEntityDescription insertNewObjectForEntityForName:@"Department" inManagedObjectContext:cxt];
    insertmodel.dp_deptname = model.dp_deptname;
    NSError *error = nil;
    if ([self.managedObjectContext save:&error]) {
        NSLog(@"数据插入成功");
        return YES;
    }else{
        NSLog(@"数据插入失败");
        return NO;
    }
    return NO;
    
}
@end
